// default language
import enUS from './lang/en-US';
import zhCN from './lang/zh-CN';
import esES from './lang/es-ES';
import jaJP from './lang/ja-JP';
// change default accept-language
import { createI18n } from 'vue-i18n'
import AppUtil from "@/assets/js/AppUtil";

export const defaultLang = 'zh-CN';

let language= AppUtil.getLanguage();
if(!language){
    language  = defaultLang;
}

const messages = {
    'en-US': {
        ...enUS
    },
    'zh-CN': {
        ...zhCN
    },
    'es-ES': {
        ...esES
    },
    'ja-JP': {
        ...jaJP
    },
}
const i18n = createI18n({
    locale: language,
    fallbackLocale: language,
    messages
})
export default i18n;

